
/**
 * temp vuex
 */
// import posts from '@/plugins/request'

// initial state
const state = {
  pageSize: 10,
  pageNum: 1,
  diaSize: 10,
  diaNum: 1,
  lastPage: 0,
  total: 0,
  diatotal:0
}
// getters
const getters = {
  getPageSize: state => state.pageSize,
  getPageNum: state => state.pageNum,
  getDiaSize: state => state.diaSize,
  getDiaNum: state => state.diaNum,
  getLastPage: state => state.lastPage,
  getDataTotal: state => state.total || 0,
  getDiaDataTotal: state => state.diatotal || 0,
}
// actions
const actions = {}

// mutations
const mutations = {
  initPageOption(state, param) {
    let total = param.total
    state.pageNum = 1
    state.total = total
    state.pageSize = param.pageSize
  },
  changePageSize(state, num) {
    state.pageSize = num
  },
  changePageNum(state, num) {
    state.pageNum = num
  },
  changeTotal(state, val) {
    state.total = val
  },
  changeDiaNum(state, num) {
    state.diaNum = num
  },
  changeDiaSize(state, num) {
    state.diaNum = num
  },
  changeDiaTotal(state, val) {
    state.diatotal = val
  },
}
export default {
  state,
  getters,
  actions,
  mutations
}